const arr = [1, 2, 3];

arr.forEach(item => {})
arr.forEach((item, index) => {})
arr.forEach((item, index, array) => {})

// 两个对象的类型兼容性
class Point {
  x: number = 1
  y: number = 2
}

class Point2D {
  x: number = 1
  y: number = 2
}

const p: Point = new Point2D()
console.log(p)

class Point3D {
  x: number = 1
  y: number = 2
  z: number = 3
}

// 属性多的类型可以兼容
const p2: Point2D = new Point3D()
console.log(p2)